//  多维运动变量
function Speed(x, y) {
    this.x = x;
    this.y = y;
}
//
Speed.prototype.run = function () {
    console.log('运动起来')
}
// 着色单元
function Color(cl) {
    this.color = cl;
}
Color.prototype.draw = function () {
    console.log('绘制色彩')
}
// 说话单元
function Speek(sp) {
    this.speek = sp;
}
Speek.prototype.say = function () {
    console.log('书写字体')
}
// 变形单元
function Shape(sp) {
    this.shape = sp;
}
Shape.prototype.change = function () {
    console.log('改变形状')
}


// 创建一个球

function Ball(x, y, c) {
    // 实现运动单元
    this.speed = new Speed(x, y)
    //实现颜色单元
    this.color = new Color(cl);
}
Ball.prototype.init = function () {
    this.speed.run();
    this.color.draw()
}

// 创建一个人

function People(x, y, f) {
    this.speed = new Speed(x, y);
    this.font = new Speek(f)
}
People.prototype.init = function () {
    this.speed.run();
    this.font.say();
}

// 创建一个精灵类

function Spirite(x, y, c, s) {
    this.speed = new Speed(x, y);
    this.shape = new Shape(s);
    this.color = new Color(c)

}
Spirite.prototype.init = function () {
    this.speed.run();
    this.color.draw();
    this.shape.change();
}

// 实例化一个人

var people = new People(10, 12, 16);
people.init();